Skip to content

feat(configurator): DX slice 1 — live scale ramp, color roles, accordion brand colors - #369

Merged
jackgranatowski merged 4 commits into
mainfrom
claude/configurator-v2-redesign-yk7qno
Jun 22, 2026
Merged

feat(configurator): DX slice 1 — live scale ramp, color roles, accordion brand colors#369
jackgranatowski merged 4 commits into
mainfrom
claude/configurator-v2-redesign-yk7qno

Conversation

@jackgranatowski

@jackgranatowski jackgranatowski commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

First slice of per-panel DX improvements bringing the configurator closer to the polish of Automatic.css and the Core Framework Editor. Focuses on the two highest-traffic panels (Typography/Spacing and Colors).

1. ScaleGenerator — Core-style live ramp

  • Always-visible two-column layout: knob inputs on the left, live step ramp on the right (no more expand-to-see collapsible).
  • Per step: stacked min/max bars with mobile (📱) and desktop (🖥) device icons, proportionally sized to the largest step, plus the computed rem values.
  • The Base anchor step (index 0) is marked with a pill.
  • Type ramps render live font-size samples ("Ag") for instant visual feedback.
  • Apply / Reset / engine-scalar logic is untouched — same single-history-step scalar writes, same fallback to baked clamp() when a scalar is missing.
  • Stacks to a single column below 780px; ctl-grid collapses to one column below 480px.

2. Colors panel — accordion brand groups

  • Core colors (Base / Neutral / Primary) always shown — what most projects customise.
  • Extended (Secondary / Tertiary) and Status colors behind opt-in <details> disclosures.
  • Each collapsed group shows a "modified" badge when any token inside has an active override, so nothing is silently hidden.

3. Semantic role swatches

  • New lib/colorRoles.js maps 12 human-readable roles (Page background, Body text, Border, Link, Focus ring…) across 4 sections to their framework consumption tokens.
  • New ColorAssignments.svelte renders a live swatch grid behind a "Semantic roles" disclosure in the Colors Settings zone.
  • Swatches resolve through the existing probe hostvar(), oklch(from …) and light-dark() all compute against the active overrides and update reactively as brand colors change.

Tests

  • generator.spec.js and undo-redo.spec.js updated for the always-open generator (.gen selector, Ratio (mobile) label, Reset / Reset viewport buttons). Behaviour under test is unchanged.
  • npm test (391 unit + 6 component) green · svelte-check 0 errors · npm run check:version green · production build clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Fg7U9rTiqBgbsPuz9kdWea


Generated by Claude Code


Summary by cubic

Upgrades the scale generator to an always-visible two‑column ramp and reorganizes the Colors panel with a semantic role preview. Fixes ramp bar sizing and a Chromium overlap issue; role swatches and “modified” badges stay accurate.

  • New Features

    • Always-visible two-column generator: inputs left, live ramp right with 📱/🖥 min/max bars sized to the largest step, a “base” pill, and “Ag” samples.
    • Clear shared viewport with “Reset viewport”; missing steps are skipped; kind tabs show when multiple kinds exist; Apply still writes engine scalars only.
    • Colors panel groups brand colors: Core (Base/Neutral/Primary) always shown; Extended (Secondary/Tertiary) and Status behind accordions with a “modified” badge.
    • Semantic role preview: ColorAssignments.svelte + lib/colorRoles.js render Surfaces/Text/Borders/Interactive swatches resolved via the probe host and reactive to overrides/theme.
  • Bug Fixes

    • Normalized ramp bars using the largest of each step’s min/max so the mobile bar stays within its track, even for inverted knob combos.
    • Prevented overlap/hit-test issues in Chromium by pinning the always-open generator section and raising the inputs column above the ramp.
    • Role swatches re-measure on override changes; “modified” badge counts both -light and -dark brand overrides; added tests/colorRoles.test.js to fail CI on role-token drift.

Written for commit 13af30a. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added semantic color role visualization with interactive swatches organized by role category (Surfaces, Text, Borders, Interactive).
    • Improved scale generator with live ramp visualization and enhanced editor layout.
  • Improvements

    • Reorganized color panel with progressive disclosure for extended colors and status colors.
    • Enhanced token preview with theme-aware resolved values and responsive layout.

…ion brand colors

ScaleGenerator becomes always-visible with a two-column layout: inputs left,
live ramp right. Each step shows proportional min/max bars (mobile/desktop
icons), a Base anchor pill, and live font-size sample text. Eliminates the
expand toggle — the generator renders inline in Settings as a first-class
control.

Colors panel gets accordion grouping: Core colors (Base/Neutral/Primary)
always shown; Extended (Secondary/Tertiary) and Status behind opt-in
disclosures with a "modified" badge when any token has an override.

New ColorAssignments.svelte + colorRoles.js: a live semantic role swatch grid
(Surfaces/Text/Borders/Interactive) collapsed behind a "Semantic roles"
disclosure. Swatches resolve via the probe host so var(), oklch(from …) and
light-dark() all compute against active overrides and update reactively.

Updated generator.spec.js and undo-redo.spec.js to match the new always-open
generator UI (.gen selector, renamed labels and buttons).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fg7U9rTiqBgbsPuz9kdWea
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a semantic color-role swatch preview: a new colorRoles.js data module, a ColorAssignments.svelte component that resolves CSS token values reactively, and progressive-disclosure wiring in DomainPanel.svelte. Separately, ScaleGenerator.svelte is redesigned from a collapsible card to an always-visible two-column gen layout with a per-step ramp visualization; e2e tests are updated to match.

Changes

Semantic Color Roles Preview

Layer / File(s) Summary
Color role data model
configurator/src/lib/colorRoles.js
Defines ColorRole/ColorRoleGroup typedefs, exports COLOR_ROLE_GROUPS with label-to-token mappings across Surfaces/Text/Borders/Interactive groups, and exports ALL_ROLE_TOKENS as a flattened probe list.
ColorAssignments swatch component
configurator/src/components/ColorAssignments.svelte
New component: uses $effect to asynchronously re-measure all role tokens against active overrides/previewTheme via computed CSS vars, populates a resolved token→RGB map, derives perceived lightness for light/dark swatch classes, and renders a grouped swatch grid with theme note.
DomainPanel progressive disclosure wiring
configurator/src/components/DomainPanel.svelte
Imports ColorAssignments; adds three disclosure states; partitions BRAND_COLOR_KEYS into primary/secondary/status arrays; replaces the flat brand/status card with always-visible core colors plus expandable Extended brand, Status, and Semantic roles disclosures (with counts and modified badges); adds .panel__expand CSS.

ScaleGenerator Always-Visible UI Redesign

Layer / File(s) Summary
ScaleGenerator derived values, markup, and styles
configurator/src/components/ScaleGenerator.svelte
Adds baseStepName and maxVal derived values; replaces isOpen-gated card markup with an always-visible gen layout (kind tabs, applied indicator, left knob column, right ramp column with anchor pill, min/max bar tracks, Ag sample, missing-token dimming); fully overhauls CSS for the two-column grid and ramp row/bar visuals.
E2E tests updated for always-visible gen
configurator/tests-e2e/generator.spec.js, configurator/tests-e2e/undo-redo.spec.js
Updates all generator test interactions to target .gen instead of .card/.gen__toggle, renames ratio selects to "Ratio (mobile)", changes reset labels from "Reset viewport range"/"Reset these" to "Reset viewport"/"Reset", and uses select[disabled]/.gen__hint for read-only assertions.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • codeslash-dev/SLASHED#310: Modifies the same DomainPanel.svelte brand/status color card rendering and BRAND_COLOR_KEYS partitioning that this PR restructures into progressive disclosure.
  • codeslash-dev/SLASHED#337: Directly modifies ScaleGenerator.svelte UI behavior around collapsibility — the inverse of this PR's change to make the generator always-visible.
  • codeslash-dev/SLASHED#313: Targets the same tests-e2e/generator.spec.js and ScaleGenerator.svelte surfaces affected by this PR's e2e test updates.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly summarizes the three main changes: ScaleGenerator redesign (live scale ramp), semantic color roles, and Colors panel reorganization (accordion brand colors).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/configurator-v2-redesign-yk7qno

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@configurator/src/components/ColorAssignments.svelte`:
- Around line 19-30: The void overrides statement in the $effect block does not
establish a reactive dependency on override properties, so the effect won't
rerun when properties within overrides change. Instead of just referencing the
overrides object with void, explicitly read the override properties (such as
iterating through Object.keys or Object.entries of overrides) to establish the
proper reactive dependency. This ensures the effect reruns whenever the override
properties are updated, keeping the swatches synchronized.

In `@configurator/src/components/DomainPanel.svelte`:
- Around line 266-267: The modified badge condition on lines 266 and 283 only
checks for light theme color overrides using the `--sf-color-${c.key}-light`
pattern, but it misses dark theme overrides. Update both conditions to also
check for the dark variant by including an additional check for
`--sf-color-${c.key}-dark` in the same logical expression, ensuring the badge
displays "modified" if either the light or dark override exists for each color
in BRAND_SECONDARY.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c74ffc2-960e-4561-a309-2e9ea13ced50

📥 Commits

Reviewing files that changed from the base of the PR and between ba60754 and 7af71f9.

📒 Files selected for processing (6)
  • configurator/src/components/ColorAssignments.svelte
  • configurator/src/components/DomainPanel.svelte
  • configurator/src/components/ScaleGenerator.svelte
  • configurator/src/lib/colorRoles.js
  • configurator/tests-e2e/generator.spec.js
  • configurator/tests-e2e/undo-redo.spec.js

Comment thread configurator/src/components/ColorAssignments.svelte
Comment thread configurator/src/components/DomainPanel.svelte Outdated
…y overrides

- ColorAssignments: read each override value in the $effect so in-place key
  mutations retrigger the swatch re-measure (void overrides subscribes to the
  binding, not its properties).
- DomainPanel: brand "modified" badge now checks both -light and -dark
  variants via a hasBrandOverride helper, so a dark-only pin still surfaces.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fg7U9rTiqBgbsPuz9kdWea

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found and verified against the latest diff

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="configurator/src/lib/colorRoles.js">

<violation number="1" location="configurator/src/lib/colorRoles.js:18">
P2: Hard-coded semantic token catalogue violates sync-only token source rule. This can drift from generated API index and silently stale role swatches.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread configurator/src/components/ScaleGenerator.svelte Outdated
*/

/** @type {ColorRoleGroup[]} */
export const COLOR_ROLE_GROUPS = [

@cubic-dev-ai cubic-dev-ai Bot Jun 22, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Hard-coded semantic token catalogue violates sync-only token source rule. This can drift from generated API index and silently stale role swatches.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At configurator/src/lib/colorRoles.js, line 18:

<comment>Hard-coded semantic token catalogue violates sync-only token source rule. This can drift from generated API index and silently stale role swatches.</comment>

<file context>
@@ -0,0 +1,54 @@
+ */
+
+/** @type {ColorRoleGroup[]} */
+export const COLOR_ROLE_GROUPS = [
+  {
+    section: 'Surfaces',
</file context>
Fix with cubic

claude added 2 commits June 22, 2026 09:21
…ole tokens

- ScaleGenerator: size proportional bars against the largest of each step's
  mobile AND desktop value, so the mobile bar stays within its track even for
  inverted knob combos (baseMin > baseMax). Identified by cubic.
- colorRoles: add a curation tripwire (tests/colorRoles.test.js) asserting
  every curated semantic role token exists in the baked api-index, mirroring
  tests/basics.test.js — a framework rename now fails CI instead of silently
  rendering a blank swatch. Addresses cubic's token-drift concern; the
  role→token map is inherently human curation, so it stays hand-authored.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fg7U9rTiqBgbsPuz9kdWea
…e shell title

The redesigned ScaleGenerator is always-open (tall) instead of collapsed, so
as a flex child of the panel's scroll container it was compressed below its
content — the grid overflowed and overlapped the Apply button and the next
card, making the button unclickable in chromium (generator + undo-redo e2e
timeouts). Pin the section with flex-shrink: 0 and raise the inputs column
above the ramp so the controls are always hit-testable.

Also update shell.spec.js to assert the renamed "Core brand colors" card
(was "Brand & status colors" before the Colors accordion split).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fg7U9rTiqBgbsPuz9kdWea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants